<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/base/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>${systemOption.systemTitle}</title>
    <%@ include file="/base/head.jsp"%>
<script language="javascript" type="text/javascript" src="${ctx}/My97DatePicker/WdatePicker.js"></script>
<link rel="stylesheet" href="${ctx}/css/salary/main.css" type="text/css"></link> 
<style type="text/css">
	body{
		text-align:center;
	}
	.buttonBack{
		width:67px;
		height:22px;
		border:1px;
		cursor: pointer;
	}
	input{
		border:1px solid gray;
		height:22px;
	}
	a:hover{
		text-decoration: underline;
	}
</style>
</head>
<body style="overflow-y:scroll">
	
   
<div class="table_top" style="height:100%" >
	<div>
		 <table width="100%" class="top" cellpadding="0" cellspacing="0">
			<tr>
				<td class="td_top"><b>当前位置:</b>&nbsp;<a href="aaaa" target="main">工资管理</a>>>保险设置
</td>
			</tr>
		 </table>
	</div>
	<div height="100%" style="margin-top:10px;">
		<br><form action=""  method="post">
		<fieldset style="width:98%">
			<legend>保险设置：</legend>
			<table border="0" cellpadding="0" cellspacing="15">
           <tr>
                <td>养老保险：工资%<input type="text" id="insurId" size="1" name="insurance.id" style="display: none"/></td>
                <td ><input type="text" id="insurOld" size="1"  name="old"/></td>
                   <td>失业保险：工资%</td>
                <td ><input type="text" size="1" id="insurunEmployment"  name="unemployment"/></td>
            </tr>
                   
            <tr>
                <td>工伤保险：工资%</td>
                <td ><input type="text" size="1" id="insurInjury" name="injury"/></td>
                  <td>生育保险：工资%</td>
                <td ><input type="text" size="1" id="insurBear" name="bear"/></td>
            </tr>
             <tr>
                <td>医疗保险：工资%</td>
                <td ><input type="text" size="1"  id="insurMedical"  name="medical" /></td>
                <td>公积金：&nbsp;&nbsp;&nbsp;工资%</td>
                <td ><input type="text" size="1"  id="insurHouse"  name="house"/></td>
            </tr>
            
            <tr>
                <td colspan="4">&nbsp;</td>
            </tr>
            <tr>
                <td colspan="3">&nbsp;</td>
                <td align="left">
                <button href="javascript:void(0)" onclick="update()" class="easyui-linkbutton buttonBack" data-options="iconCls:'icon-edit',plain:true">修改</button>
                <span id="message" style="display: none;color: blue"></span>
                </td>
            </tr>
        </table>
     </fieldset>
     </form>
    </div>
  </div>
</body>
	<script type="text/javascript">
		$(function(){//页面加载完成时
			initPage();
		});
	
		function initPage(){
			$.ajax({url:"${ctx}/insurance/load.action", async:false,success:function(data) {
				$('#insurId').val(data.id);
				$('#insurOld').val(data.old);
				$('#insurunEmployment').val(data.unemployment);
				$('#insurInjury').val(data.injury);
				$('#insurBear').val(data.bear);
				$('#insurMedical').val(data.medical);
				$('#insurHouse').val(data.house);
			}
			});	
		}
	
		
		function update(){
			var id = $('#insurId').val();
			var old = $('#insurOld').val();
			var unemployment = $('#insurunEmployment').val();
			var injury = $('#insurInjury').val();
			var bear = $('#insurBear').val();
			var medical = $('#insurMedical').val();
			var house = $('#insurHouse').val();
			
		
			if(old ==''){
				 $.messager.alert('错误提示','请输入养老保险百分比','error');
				 return;
			}
			if(unemployment ==''){
				 $.messager.alert('错误提示','请输入失业保险百分比','error');
				 return;
			}
			if(injury ==''){
				 $.messager.alert('错误提示','请输入工伤保险百分比','error');
				 return;
			}
			if(bear ==''){
				 $.messager.alert('错误提示','请输入生育保险百分比','error');
				 return;
			}
			if(medical ==''){
				 $.messager.alert('错误提示','请输入医疗百分比','error');
				 return;
			}
			if(house ==''){
				 $.messager.alert('错误提示','请输入公积金百分比','error');
				 return;
			}
				
			$.post("${ctx}/insurance/update.action", 
			{id:id,old:old,unemployment:unemployment,injury:injury,bear:bear,medical:medical,house:house},
			function(data) {
					 $('#message').show();
					 $('#message').html('修改成功');
					 //setTimeout("$('#message').hide();",5000);
					// $.messager.alert('友情提示','修改成功','info');
					 //initPage();
			});			
			
		
		}
	</script>
</html>